const express = require('express')
const app = express()
const path = require('path')
const bodyParser  = require('body-parser')
const book = require('./routes/book.controller')
// app.use('/')
app.engine('html',require('express-art-template'))
app.set('views',path.join(__dirname,'views/'))
app.use(bodyParser.urlencoded({extended:true}))
app.use(bodyParser.json())
app.all('*',function (req,res,next) {
    res.header("Access-Control-Allow-Origin","*")
    next()
})

app.use(express.static('other'))
// app.use('/static', express.static('public'))
app.use('/',book)

app.listen(3002,function () {
    console.log("listen on :3002")
})



const { config } = require('process');
const readline = require('readline');

const rl = readline.createInterface({

    input: process.stdin,
});

let buf = [];
var i=0;

rl.on('line', (line) => {
    if(i>1){
        if(i==buf[0].split(" ")[1]){
            buf.push(line);
            rl.close()
        }
    }
    // if (line.trim() == "") rl.close()
    buf.push(line);
    i++

})
rl.on('close', () => {
    var n=buf[0].split(" ")[1],dd="",ls,ary=[],ary2=[],xary=[],str="",flag=true,a,b;
    ls=buf.splice(1)
    ls.forEach((v)=>{
        xary.push(v.split("").reverse().join().replace(/,/g,"").replace(/@/g,buf[0].split(" ")[0]));
        ary.push(v.split("").reverse().join().replace(/,/g,""))
    })
    ary2 = ary.reverse()
    for(let i=0;i<ls.length;i++){
        if (ls[i]!=ary2[i]){
            flag=false;
        }
    }
    if (flag){
        console.log("bu yong dao le");
        xary2=xary;
    }else{
        xary2=xary.reverse()
    }
    xary2.forEach((v)=>{
        console.log(v)
    })
});
